import { MobilePageDesigner, Props } from 'components/mobilePageDesigner';
import { StationService as AdminStation } from 'admin/services/station';
import { StationService as UserStation } from 'user/services/stationService';
import ReactDOM = require('react-dom');
import * as chitu from "maishu-chitu";
import React = require('react');

export default async function (page: chitu.Page) {

    let adminStation = page.createService(AdminStation);
    let userStation = page.createService(UserStation);

    let pageData: PageData = await userStation.pages.member();
    let props: Props = {
        pageData,
        save: (pageData) => adminStation.savePageData(pageData),
        showComponentToolbar: false,
        showTemplateButton: false,
        showSnapshootButton: false,
        elementPage: page,
    }
    ReactDOM.render(<MobilePageDesigner {...props} />, page.element);
}

